
#include "utilities.h"

#include "gsl/gsl_rng.h"

//#include "numeric.h"
//#include "emig.h"

#ifdef ENABLE_MULTIMAX

void Get_TA_Neighbor_Proposition(t_tree *tree, phydbl temp);
void Get_QA_Neighbor_Proposition(t_tree *tree);
void Get_Neighbor_Proposition(t_tree *tree,phydbl temp);
phydbl Boltzmann_P_TA(phydbl lnl_curr, phydbl lnl_new, phydbl temperature);
phydbl Boltzmann_P_QA(phydbl lnl_curr, phydbl lnl_new, phydbl distance, phydbl tfield);
phydbl Thermal_Anneal_All_Free_Params(t_tree *tree, int verbose);
phydbl Quantum_Anneal_All_Free_Params(t_tree *tree, int verbose);
phydbl Scale_T_Factor(t_tree *tree);
void Step_Brlen_Proportion(t_tree *tree);
void Swap_Tree_And_Mod(t_tree *tree1, t_tree *tree2);
void Step_Gamma(t_tree *tree);
void Step_Branch_Lengths(t_tree *tree,phydbl temp);
void Step_Topology(t_tree *tree);
void Step_Pi(t_tree *tree);
void Step_Lambda(t_tree *tree);
void Step_Kappa(t_tree *tree);
void Step_RR(t_tree * tree);
void Step_Pinvar(t_tree *tree);
void Free_Anneal();
void Set_Annealing_Defaults(option *io);

//
// Global parameters.
// We should provide the option to set these parameters at runtime,
// but we should also provide default values.
//
typedef struct ANNEALING{
	int 	num_anneal_stages; 	// the number of temperate values to try
	phydbl 	start_temp;	// initial temperature
	phydbl 	end_temp;	// order of magnitude of desired accuracy
	phydbl  start_tau;
	phydbl  end_tau;
	int 	iters_per_temp;	// number of tries at each temperature
	int 	set_back;	// number of steps to step back if improving
	phydbl  t_scalar;	// temperature scalar for calculating Boltzmann's constant

	phydbl 	prob_trans_model;
	phydbl 	prob_topology;
	phydbl	prob_TBR;
	phydbl 	prob_SPR;
	phydbl  prob_NNI;
	phydbl 	prob_rate_proportion;
	phydbl 	prob_brlen;
	phydbl	prob_gamma;
	phydbl 	prob_pinvar;
	phydbl  prob_pi;
	phydbl  prob_kappa;
	phydbl  prob_lambda;
	phydbl  prob_rr;
	phydbl  prob_emig;

	phydbl 	max_alpha;
	phydbl  brlen_sigma;
	phydbl	gamma_sigma;
	phydbl  lambda_sigma;
	phydbl  kappa_sigma;
	phydbl  pinvar_sigma;
	phydbl  emig_sigma;
	int 	no_change; // 1 = we made NO changes to the parameters (and therefore, likelihoods do
						// not need to be recomputed.  If == 0, then YES we made changes.

	int     random_seed;
    gsl_rng *rng;
}t_annealing;

#endif
